package com.liu.controller;

import com.alibaba.fastjson.JSON;
import com.liu.model.User;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

@Controller//@RestController
public class RestFulController {

    @RequestMapping(name="/add/{a}/{b}",method={RequestMethod.DELETE,RequestMethod.POST,RequestMethod.GET})
    public String Add(@PathVariable int a,@PathVariable int b, Model model){
        System.out.println(a + b);
        model.addAttribute("msg",a+b);
        /* 重定向：redirect: */
        return "add";
    }

    @PostMapping("/del")
    public String del(User user){

        JSON.toJSONString(user);
        return "add";
    }


}
